﻿using LY.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.DataAccess.Repository
{
    public class ProjectAttentionRepository : BaseRepository
    {
        //取消关注
        public int CancelAttention(int id, int memberId)
        {
            string sql = "delete from R_ProjectAttention where Projectid=@Projectid and Member=@Member ";
            return base.Excute(sql, new { Projectid = id, Member = memberId });
        }
        //判断该用户是否关注过该项目
        public int getAttention(int id, int memberId)
        {
            int i = 1;
            string sql = @"SELECT [Id]
                          ,[Projectid]
                          ,[Member]
                          ,[Addtime]
                          ,[Type]
                           FROM [R_ProjectAttention] where Projectid=@Projectid and Member=@Member";
            if (base.Query<R_ProjectAttention>(sql, new { Projectid = id, Member = memberId }).Count == 0)
            {
                i = 0;
            }
            return i;
        }
    }
}
